/*
 * @Description: 请求
 * @Author: liangrongjun
 * @Date: 2021-09-27 10:02:32
 * @LastEditors: liangrongjun
 * @LastEditTime: 2021-10-21 15:53:13
 */
// @ts-nocheck
import axios from 'axios';
import { Toast } from "antd-mobile";

// 创建axios实例
const service = axios.create({
    timeout: 5000
})

// request interceptor request拦截器
service.interceptors.request.use(config => {
    return config;
}, error => {
    Promise.reject(error)
});

// response interceptor request拦截器
service.interceptors.response.use(function (response) {
    return response;
  }, function (error) {
    if(error.message.includes('timeout')){
        Toast.fail("网络超时，请重试~");
        return Promise.reject(error);
      }
      return Promise.reject(error);
  });

export default service